<template>
  <div class="detail">
    <div class="left-detail">
      <!-- 顶部导航 -->
      <div class="change-tab">
        <a href="javascript:;" @click="status = 1">
          <div :class="[status === 1 ? 'active' : '']"></div>
          商品详情</a
        >
        <a href="javascript:;" @click="status = 2">
          <div :class="[status === 2 ? 'active' : '']"></div>
          商品评价 <span>(998+)</span></a
        >
      </div>
      <!-- 详情 -->
      <div class="tab-pane" v-if="status === 1">
        <div class="goods-detail">
          <!-- 商品表格数据 -->
          <div class="attrs">
            <!--表格 -->
            <div class="item" v-for="item in 7" :key="item">
              <span>包装:</span>
              <span>礼盒包装、旅行便携</span>
            </div>
            <!-- 图片介绍 -->
            <div class="img-detail">
              <img
                src="https://yanxuan-item.nosdn.127.net/bab68f4f06b97da0f8fce8266028d840.jpg?type=webp&imageView&quality=90"
                alt=""
              />
              <img
                src="https://yanxuan-item.nosdn.127.net/f797f964f06608eed86e254a7073aec1.jpg?type=webp&imageView&quality=90"
                alt=""
              />
              <img
                src="https://yanxuan-item.nosdn.127.net/047f0161494b503c0d7c21ed092969cf.jpg?type=webp&imageView&quality=90"
                alt=""
              />
              <img
                src="https://yanxuan-item.nosdn.127.net/dcf90f89224da0b8a7c91861d445d470.jpg?type=webp&imageView&quality=90"
                alt=""
              />
              <img
                src="https://yanxuan-item.nosdn.127.net/f80f67361b1d660092907b941fe82827.jpg?type=webp&imageView&quality=90"
                alt=""
              />
              <img
                src="https://yanxuan-item.nosdn.127.net/b09fe81f4163c1a7ee3b7d6bb04a81d4.jpg?type=webp&imageView&quality=90"
                alt=""
              />
              <img
                src="https://yanxuan-item.nosdn.127.net/28d6f5bdfd2cacd77b9bf94d4026751d.jpg?type=webp&imageView&quality=90"
                alt=""
              />
              <img
                src="https://yanxuan-item.nosdn.127.net/d8aa8e166439f4ad6a44c8299893bf8d.jpg?type=webp&imageView&quality=90"
                alt=""
              />
              <img
                src="https://yanxuan-item.nosdn.127.net/179ce2259a84a6704d353e20b1dfa559.jpg?type=webp&imageView&quality=90"
                alt=""
              />
            </div>
          </div>
        </div>
      </div>
      <!-- 商品评价 -->
      <GoodsEvaluate v-if="status === 2"></GoodsEvaluate>
    </div>
    <!-- 热榜 -->
    <div class="right-hot">
      <div class="title">24小时热榜</div>
      <div class="product" v-for="item in 3" :key="item">
        <img
          src="http://zhoushugang.gitee.io/erabbit-client-pc-static/uploads/kitchen_goods_1.jpg"
          alt=""
        />
        <p class="name">USB Type C数据线</p>
        <p class="desc">快速充电，稳定传输</p>
        <p class="price">¥29</p>
      </div>
      <div class="title">专题推荐</div>
      <div class="special" v-for="item in 3" :key="item">
        <img
          src="http://zhoushugang.gitee.io/erabbit-client-pc-static/uploads/discuss_goods_1.jpg"
          alt=""
        />
        <p class="name">一往无前，诞生于崛起</p>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import GoodsEvaluate from './GoodsEvaluate.vue';
import { ref } from 'vue';
let status = ref(1);
</script>
<style scoped lang="less">
.detail {
  display: flex;
  color: #333;
  font-size: 18px;
  justify-content: space-between;
}
.left-detail {
  width: 942px;
  background-color: #fff;
}
.change-tab {
  height: 70px;
  border-bottom: 1px solid rgb(245, 245, 245);
  font-size: 18px;
  padding: 0 40px;
  position: relative;
  line-height: 70px;

  &::before {
    content: '';
    position: absolute;
    height: 70px;
    width: 1px;
    background-color: rgb(245, 245, 245);
    top: 0;
    left: 152px;
  }
  a {
    margin-right: 80px;
    display: inline-block;
    position: relative;
    .active {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 72px;
      height: 2px;
      background-color: rgb(39, 186, 155);
    }
    span {
      color: rgb(207, 68, 68);
    }
  }
}
.goods-detail {
  padding: 25px;
  .attrs {
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    .item {
      width: 50%;
      display: flex;
      padding-bottom: 10px;
      & > span:nth-child(1) {
        width: 100px;
        color: rgb(153, 153, 153);
      }
      & > span:nth-child(2) {
        flex: 1 1 0%;
        color: rgb(102, 102, 102);
      }
    }
    .img-detail {
      img {
        width: 100%;
        min-height: 137px;
        background: center/cover no-repeat 50%;
      }
    }
  }
}
.right-hot {
  width: 278px;
  .title {
    width: 278px;
    height: 70px;
    background-color: rgb(226, 98, 55);
    color: rgb(255, 255, 255);
    font-size: 18px;
    line-height: 70px;
    padding-left: 25px;
    margin-bottom: 10px;
  }
  .product {
    margin-bottom: 10px;
    background-color: #fff;
    width: 100%;
    height: 360px;
    text-align: center;
    img {
      width: 190px;
      height: 190px;
      margin-top: 25px;
    }
    .name {
      font-size: 16px;
      line-height: 40px;
    }
    .desc {
      color: rgb(153, 153, 153);
      line-height: 50px;
    }
    .price {
      color: rgb(207, 68, 68);
      font-size: 18px;
      line-height: 50px;
    }
  }
  .special {
    background-color: #fff;
    text-align: center;
    margin-bottom: 10px;
    img {
      width: 278px;
      height: 212px;
    }
    .name {
      font-size: 18px;
      padding: 24px 0;
    }
  }
}
</style>
